﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace StorageBox
{
    public class AddApplyFactory : ElementFactory, IElementFactory<AddApplyElement, AddApplyData>
    {
        private static TextBox applyPath;
        private static TextBox iconPath;
        private static Button conifomBut;
        private static WrapPanel back;


        public AddApplyElement Create(AddApplyData data)
        {
            var element = new AddApplyElement(data);
            return element;
        }

        public void GetValue(out string applyPath, out string iconPath)
        {
            applyPath = AddApplyFactory.applyPath.Text;
            iconPath = AddApplyFactory.iconPath.Text;
        }

        public static void SetViewElement(MainWindow main)
        {
            applyPath = main.MessageTemplate_AddApplyBox_ApplyPath;
            iconPath = main.MessageTemplate_AddApplyBox_ApplyIconPath;
            conifomBut = main.MessageTemplate_AddApplyBox_Confirm;
            back = main.MessageTemplate_AddApplyBox_Back;

            main.TemporaryList.Children.Remove(back);
        }

        public static AddApplyData GetData()
        {
            return new AddApplyData(applyPath, iconPath, conifomBut, back);
        }
    }

    public class AddApplyData : ElementData
    {
        public TextBox applyPath;
        public TextBox iconPath;
        public Button conifomBut;
        public WrapPanel back;

        public AddApplyData(TextBox appluPath, TextBox iconPath, Button but, WrapPanel back)
        {
            this.applyPath = appluPath;
            this.iconPath = iconPath;
            this.conifomBut = but;
            this.back = back;
        }
    }
}
